<%-- 
    Document   : edit_required_subject
    Created on : Dec 8, 2011, 4:43:09 PM
    Author     : songvu
--%>

<%@page import="java.util.LinkedList"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="GetData.DataWS"%>
<%@page import="dktc_ws.Monhoc"%>
<%@page import="dktc_ws.Montienquyet"%>
<!DOCTYPE html>

<%
    DataWS ws = new DataWS();
    Monhoc mh = new Monhoc();
    mh.setMamh(request.getParameter("id"));
    mh = ws.laydanhsachmonhoc(mh.getMamh()).get(0);
    List<Monhoc> dsmonhoc = ws.laydanhsachmonhoc("");
    List<Montienquyet> dsmontq = ws.laydanhsachmontienquyet(mh.getMamh());
    List<String> dsmamontq = new LinkedList<String>();
    for (int i=0;i<dsmontq.size();i++)
        dsmamontq.add(dsmontq.get(i).getMamhTq());
    
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <table>
            <tr>
                <td><h1>CẬP NHẬT MÔN TIÊN QUYẾT</h1></td>
            </tr>
            <tr>
                <td>Mã môn học: <%=mh.getMamh()%></td>
            </tr>
            <tr>
                <td>Môn học: <%=mh.getTenmh()%></td>
            </tr>
            <tr>
                <td>Môn tiên quyết:</td>
            </tr>
            <form>
                <input type="hidden" name="mamh" value="<%=mh.getMamh()%>"/>
            <tr>
                <td>
            <select multiple="yes" size="10" name="mamontq" >
                <% for (int i=0; i<dsmonhoc.size();i++)
                     {
                            Monhoc montq = dsmonhoc.get(i);
                            if (mh.getMamh().compareTo(montq.getMamh()) == 0)
                                continue;
                    %>
                    <option value="<%=montq.getMamh()%>" <%=(dsmamontq.indexOf(montq.getMamh())== -1)?"":"selected=\"selected\""%>><%=montq.getTenmh()%></option>
                    <%}%>
            </select>
                </td>
            </tr>
            <tr>
                <td><input type="submit" name="editrequiredsubjects" value="Cập nhật"/></td>
            </tr>
            </form>
        </table>

    </body>
</html>
